<?php

/**
 * Example d'utilisation des Models FriendsMore
 */
require_once 'PDO_Mysql.php';
require_once 'User.php';
require_once 'User_Info.php';
require_once 'User_Connexion.php';
require_once 'User_Question.php';
require_once 'User_Reponse.php';
require_once 'Question.php';



//Instancie les models
$tableUser = new Model_User();
$tableUserInfo = new Model_User_Info();
$tableUserConnexion = new Model_User_Connexion();
$tableUserQuestion = new Model_User_Question();
$tableUserReponse = new Model_User_Reponse();
$tableQuestion = new Model_Question();

/*
// Set user
$data = array(
    'nom' => 'Samandam',
    'prenom' => 'kaartik',
    'email' => 'ksammandam@gmail.com',
    'id_facebook' => '151212F154541',
    'date_creation' => date('y-m-d H:i:m')
);
try {
    $id_user = $tableUser->setUser($data);
} catch (Exception $exc) {
    echo $exc->getTraceAsString();
}

// Set User Info
$dataInfo = array(
    'id_user' => $id_user,
    'date_naissance' => '1989-11-23',
    'ville' => 'Paris',
    'origine' => 'France'
);
try {
    $row = $tableUserInfo->setUserInfo($dataInfo);
} catch (Exception $exc) {
    echo $exc->getTraceAsString();
}
*/

// Set User Connextion a chaque fois que
// l'utilisateur se logge
//try {
//   $row = $tableUserConnexion->setUserConnexion(1); 
//} catch (Exception $exc) {
//    echo $exc->getTraceAsString();
//}


//$users = $tableUser->getAllUser();
//var_dump($users);

//echo '<p>**********User INFO*********</p>';
//$userInfo = $tableUserInfo->getUserInfoById(1);
//var_dump($userInfo);

//echo '<p>********** User CONNEXION *********</p>';
//$userConnexion = $tableUserConnexion->getUserConnexionById(1);
//var_dump($userConnexion);

//echo '<p>********** User INFO JOIN LEFT *********</p>';
//$usersInfos = $tableUser->getAllUserWithInfo();
//
//var_dump($usersInfos);


//echo '<p>************* User Question *************</p>';
//$user_question = $tableUserQuestion->getQuestion(1, 1);
//var_dump($user_question);

//echo '<p>************* Question ************</p>';
//$question = $tableQuestion->getQuestionByTypeQuestionId(2);
//var_dump($question);
?>